package com.alinesno.cloud.compoment.kafka.config;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * 基础配置类
 * 
 * @author WeiXiaoJin
 * @since 2019年12月3日 下午8:45:25
 */
public abstract class Config {

	/**
	 * properties to map
	 * 
	 * @param properties
	 * @return
	 */
	protected Map<String, Object> toMap(Properties properties) {
		Map<String, Object> result = new HashMap<String, Object>();
		Enumeration<?> propertyNames = properties.propertyNames();
		while (propertyNames.hasMoreElements()) {
			String name = (String) propertyNames.nextElement();
			String value = properties.getProperty(name);
			result.put(name, value);
		}
		return result;
	}
}
